GCC+Win32: Ensure stack alignment in SSE code
authorDaniel Sabo <DanielSabo@gmail.com>
Tue, 18 Jun 2013 04:33:49 +0000 (21:33 -0700)
committerDaniel Sabo <DanielSabo@gmail.com>
Tue, 18 Jun 2013 04:42:24 +0000 (21:42 -0700)
Without this option GCC will generate bad code that attempts to
push SSE variables onto an unaligned stack.

configure.ac

index 2ddb3a5a6677337cbcdde3b34ca66215a54c4a4d..98dbe5d5e335f206d7bacdf69393ba4e6e156304 100644 (file)
@@ -316,7 +316,10 @@ if test "x$enable_mmx" = xyes; then
 
     if test "x$enable_sse" = xyes; then
       BABL_DETECT_CFLAGS(fpmath_flag, '-mfpmath=sse')
-      SSE_EXTRA_CFLAGS="$MMX_EXTRA_CFLAGS $fpmath_flag"
+      if test "x$platform_win32" = xyes; then
+        BABL_DETECT_CFLAGS(stack_align, '-mstackrealign')
+      fi
+      SSE_EXTRA_CFLAGS="$MMX_EXTRA_CFLAGS $stack_align $fpmath_flag"
       
       BABL_DETECT_CFLAGS(sse_flag, '-msse')
       SSE_EXTRA_CFLAGS="$SSE_EXTRA_CFLAGS $sse_flag"